<template>
  <div class="box">
    <Header />
    <div class="content">
      <div>任务详情:</div>
      <div class="top">
        <span style="width:200px">待转译C源码库地址:</span>
        <span>{{ detail&&detail.cUrl }}</span>
      </div>
      <div class="bot">
        <span style="width:80px">创建人:</span>
        <span>{{ detail&&detail.userName }}</span>
      </div>
      <div class="bot">
        <span style="width:80px">悬赏:</span>
        <span>{{ detail&&detail.rewardAmount }}</span>
      </div>
      <div class="bot">
        <span style="width:80px">创建时间:</span>
        <span>{{ detail&&detail.createdTime }}</span>
      </div>
      <div class="fbTask">
        <el-button type="primary" @click="router.go(-1)">关闭</el-button>
      </div>
    </div>
  </div>
</template>
  <script setup>
import { onMounted, ref } from 'vue'
import { ElMessage } from 'element-plus'
import Header from '../components/header.vue'
import { userApi } from '@/api/user'
import router from '../../router'

let detail = ref()
onMounted(() => {
  getDetail()
})
const getDetail = async () => {
    let res = await userApi.getTask(router.currentRoute.value.query.id)
    if(res.meta.code == 2000){
        detail.value = res.data
    }else{
        ElMessage.error('获取详情失败!')
    }
    console.log(res,';;;;;;;;;');
}
</script>
  <style lang="less" scoped>
.box {
  width: 100%;
  height: 100%;
  .content {
    width: 600px;
    margin: 0 auto;
    padding: 20px;
    background: #fff;
    margin-top: 30px;
    .bot {
      margin-top: 30px;
      width: 80%;
      padding: 20px;
      border: 1px solid #333;
      border-radius: 10px;
      display: flex;
      align-items: center;
    }
    .top {
      margin-top: 30px;
      width: 80%;
      padding: 20px;
      border: 1px solid #333;
      border-radius: 10px;
      display: flex;
      align-items: center;
    }
  }
}

.fbTask {
  display: flex;
  margin-top: 20px;
  justify-content: flex-end;
}
</style>